package com.hxjr.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class LoadingDialog extends Dialog
{

	private Context context;

	public LoadingDialog(Context context)
	{
		super(context, R.style.loading_dialog);
		this.context = context;
	}

	@Override
	public void show()
	{
		super.show();
		View v = LayoutInflater.from(context).inflate(R.layout.loading_dialog,
				null);// 得到加载view
		LinearLayout layout = (LinearLayout) v.findViewById(R.id.dialog_view);// 加载布局
		ImageView iv = (ImageView) v.findViewById(R.id.iv);
		// 加载动画
		Animation hyperspaceJumpAnimation = AnimationUtils.loadAnimation(
				context, R.anim.loading_animation);
		iv.startAnimation(hyperspaceJumpAnimation);
		setCancelable(true);
		setContentView(layout, new LinearLayout.LayoutParams(
				LinearLayout.LayoutParams.MATCH_PARENT,
				LinearLayout.LayoutParams.MATCH_PARENT));// 设置布局
	}

}
